<?php
$this->breadcrumbs=array(
	'Turmas'=>array('index'),
	'Gerenciar',
);

$this->menu=array(
	array('label'=>'Listar Turmas', 'url'=>array('index')),
	array('label'=>'Criar Turmas', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('cad-turma-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Turmas</h1>


<?php 
// echo CHtml::link('Busca Avançada','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php
// $this->renderPartial('_search',array(
//	'model'=>$model,
// )); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'cad-turma-grid',
        'pager' => array('cssFile' => Yii::app()->baseUrl . '/themes/'.Yii::app()->theme->name.'/gridView.css'),
        'cssFile' => Yii::app()->baseUrl . '/themes/'.Yii::app()->theme->name.'/css/gridView.css',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
                array(
                       'name'=>'cod_turma',
                       'type'=>'raw',
                       'value'=>'cad_turma::loadTableTurma($data->cod_turma)'
                    ),             
                array(
                       'name'=>'cod_periodo',
                       'type'=>'raw',
                       'value'=>'cad_periodo::loadTablePeriodo($data->cod_periodo)'
                    ),            		
		'nome',
		'carga_hora',
		'numero_alunos',
                array(
                       'name'=>'professor',
                       'type'=>'raw',
                       'value'=>'cad_professor::loadTableProfessor($data->professor)'
                    ),
		array(
			'class'=>'CButtonColumn',
		),
	),
)); ?>
